﻿package com.xuanque.mahjongDice.display{

	import datas.User;
	import com.xuanque.mahjongDice.util.LoaderImg;
	
	import flash.display.*;
	import flash.net.URLRequest;
	import flash.text.*;
	import flash.events.*;

	public class UserInfo extends Sprite {
		
		private var _user:UserInfo;
		private var _loader:Loader;
		
		public function UserInfo() {
			
			this._user = this;
			
			//测试用
			
			//User.getInstance().setLoginName("测试用户");
			//User.getInstance().setSeed(99999);
			//User.getInstance().setGrading(0);//等级
			//User.getInstance().setPhoto("head/man/1.png");
			
			//bulidUserInfo(User.getInstance());
		}
		
		/**
		* 只写属性.
		* @param data player 个人用户信息
		*/
		public function bulidUserInfo(user:User):void{
			
			//_user.nickName_txt.text = String(user.getLoginName());
			_user.nickName_txt.text = String(user.getNickName());
			_user.seed_txt.text = String(user.getSeed());
			_user.grading_txt.text = String(user.getGrading());
			//_user.win_txt.text = String(user.getWinNum());
			//_user.lose_txt.text = String(user.getLoseNum());
			
			//trace(player.getPhoto());
			if (user.getPhoto() != null) {
				
				LoaderImg.getInstance().loadPhoto(this.head_mc, user);
			}
			
			
		}
		
		
		/*
		 * 更新设置用户信息 
		*/
		public function refreshText():void {
			
			_user.seed_txt.text = String(User.getInstance().getSeed());
			_user.grading_txt.text = String(User.getInstance().getGrading());
			
		}
		
		
		
		
		
	}
}